#include "selectServer.hpp"
#include <memory>
#include "err.hpp"

using namespace std;
using namespace select_ns;

static void Usage(std::string proc)
{
    std::cerr << "Usage:\n\t" << proc << " port"
              << "\n\n";
}
std::string transaction(const std::string &request)
{
    std::string prefix("[server echo#] ");
    return prefix + request;
}
// ./selectServer 8080
int main(int argc, char *argv[])
{
    // if (argc < 2)
    // {
    //     Usage(argv[0]);
    //     exit(USAGE_ERR);
    // }
    // 服务器的调用逻辑都是一样的

    unique_ptr<selectServer> svr(new selectServer(transaction)); // atoi(argv[1])不传端口号了，默认使用8080

    svr->initServer();
    svr->start();

    return 0;
}